package com.cwz.core.exception.service;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @program: w-demo
 * @description: 业务异常类
 * @author: Wen
 **/
@Getter
@NoArgsConstructor
@AllArgsConstructor
public class ServiceException extends RuntimeException {
	private static final long serialVersionUID = 1L;

	/**
	 * 错误码
	 */
	private Integer code;

	/**
	 * 错误提示
	 */
	private String message;

	/**
	 * 错误明细，内部调试错误
	 */
	private String detailMessage;


	public ServiceException(String message) {
		this(null, message, null);
	}

	public ServiceException(Integer code, String message) {
		this(code, message, null);
	}

	public ServiceException setMessage(String message) {
		this.message = message;
		return this;
	}

	public ServiceException setDetailMessage(String detailMessage) {
		this.detailMessage = detailMessage;
		return this;
	}

}
